package topic

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method 'POST'
        url 'api/topics'
        body("""
           {
             "programId": 1,
             "title": "title",
             "createTime": "2016-09-09 00:00:00.0",
             "orderNumber": 1,
             "visible": true
           }
        """)
        bodyMatchers {
            jsonPath('$.programId',byRegex(number()))
            jsonPath('$.title',byRegex(nonEmpty()))
            jsonPath('$.createTime',byRegex(nonEmpty()))
            jsonPath('$.orderNumber',byRegex(number()))
            jsonPath('$.visible',byRegex(anyBoolean()))
        }
        headers {
            contentType(applicationJsonUtf8())
        }
    }
    response {
        status 201
    }
}